﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Journal.aspx.cs" Inherits="Web.Journal" %>

<asp:Content ID="Content1" ContentPlaceHolderID="Head" runat="server">

    <link rel="stylesheet" href="/Share/Styles/Journal.css" />

    <script type="text/javascript">

        function checkKey(e, lessonId) {
            var prevValue = $("#TbMark" + lessonId).val();
            e = e || event;
            if (!e) { return true; }
            var code = e.keyCode || e.which || null;
            if ((code >= 49 && code <= 53) || (code >= 65 && code <= 90) || code === 8) {
                $("#LessonId").val(lessonId);
                $("#TbMark" + lessonId).val(String.fromCharCode(e.keyCode));
                $("#MarkValue").val($("#TbMark" + lessonId).val());
                $("#BtnSaveMark").click();
            }
            else {
                $("#TbMark" + lessonId).val(prevValue);
            }
            return true;
        }

    </script>

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="Main" runat="server">

    <section id="JournalFiters" class="inset-shadow box clear-fix filter">

        <div class="wrapper left">
            <asp:DropDownList runat="server" ID="DdlSemestersFilter" AutoPostBack="True" OnSelectedIndexChanged="DdlSemestersFilter_OnSelectedIndexChanged" />
        </div>

        <div class="wrapper left">
            <asp:DropDownList runat="server" ID="DdlGroupsFilter" AutoPostBack="True" OnSelectedIndexChanged="DdlGroupsFilter_OnSelectedIndexChanged" />
        </div>

        <div class="wrapper left">
            <asp:DropDownList runat="server" ID="DdlSubjectsFilter" AutoPostBack="True" OnSelectedIndexChanged="DdlSubjectsFilter_OnSelectedIndexChanged" />
        </div>

    </section>

    <asp:UpdatePanel runat="server" ID="UpdatePanelStudyYearsJournal">
        <ContentTemplate>

            <section id="Journal" class="inset-shadow box clear-fix">

                <header class="clear-fix">

                    <h3 runat="server" id="JournalHeader" class="left">
                        <%= SelectedGroup.Name %>. <%= SelectedSubject.Name%>
                    </h3>

                </header>

                <div id="TablesWrap" class="clear-fix">
                    <div id="StudentsListTableWrap" class="left">

                        <asp:ListView runat="server" ID="ListViewStudents">

                            <LayoutTemplate>
                                <table class="table-bordered">
                                    <thead>
                                        <tr>
                                            <th>№</th>
                                            <th>ФИО студента</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <asp:PlaceHolder ID="ItemPlaceholder" runat="server" />
                                    </tbody>
                                </table>
                            </LayoutTemplate>

                            <ItemTemplate>
                                <tr>
                                    <td><%# Eval("No") %></td>
                                    <td><%# Eval("Fio") %></td>
                                </tr>
                            </ItemTemplate>

                        </asp:ListView>

                    </div>

                    <div runat="server" id="MarksTableWrap" class="left">
                        <input runat="server" id="LessonId" type="hidden" />
                        <input runat="server" id="MarkValue" type="hidden" />
                        <asp:Button runat="server" ID="BtnSaveMark" CssClass="hidden" OnClick="BtnSaveMark_OnClick" />
                    </div>

                    <div id="ResultMarksTableWrap" class="left">
                        <asp:Table runat="server" ID="TableResultMarks" CssClass="table-bordered"></asp:Table>
                        </table>
                    </div>
                </div>

            </section>

        </ContentTemplate>
    </asp:UpdatePanel>

</asp:Content>
